{% extends "base.html" %}
{% load utils %}

{% block content %}
{% with transaction as tranc %}{% with tranc|get_tranc_type as tranc_type %}

<div id="content-header">
<h2>查看交易({{ tranc|get_tranc_disp_name }})</h2>
<div class="clear"></div>
</div>

<table class="tranc">
{# === Deposit === #}
{% if tranc_type == 'deposit' %}
<tr>
	<th>存入账户</th>
	<td>{{ tranc.member.name }}</td>
</tr>
<tr>
	<th>金额</th>
	<td>{{ tranc.amount }}元</td>
</tr>
<tr>
	<th>用途</th>
	<td>{{ tranc.usage }}</td>
</tr>
<tr>
	<th>备注</th>
	<td class="comment">{{ tranc.detail|default:"<i>无</i>"|linebreaks }}</td>
</tr>
<tr>
	<th>交易时间</th>
	<td>{{ tranc.time|local_time|date:"Y年n月d G点i分" }}</td>
</tr>
<tr>
	<th>创建者</th>
	<td>{{ tranc.creator.name }}</td>
</tr>
<tr>
	<th>创建时间</th>
	<td>{{ tranc.created|local_time|date:"Y年n月d G点i分" }}</td>
</tr>
{# === Draw === #}
{% else %}{% if tranc_type == 'draw' %}
<tr>
	<th>取出账户</th>
	<td>{{ tranc.member.name }}</td>
</tr>
<tr>
	<th>金额</th>
	<td>{{ tranc.amount }}元</td>
</tr>
<tr>
	<th>用途</th>
	<td>{{ tranc.usage }}</td>
</tr>
<tr>
	<th>备注</th>
	<td>{{ tranc.detail|default:"<i>无</i>" }}</td>
</tr>
<tr>
	<th>交易时间</th>
	<td>{{ tranc.time|local_time|date:"Y年n月d G点i分" }}</td>
</tr>
<tr>
	<th>创建者</th>
	<td>{{ tranc.creator.name }}</td>
</tr>
<tr>
	<th>创建时间</th>
	<td>{{ tranc.created|local_time|date:"Y年n月d G点i分" }}</td>
</tr>
{# === Pay & DepositAndPay === #}
{% else %}{% if tranc_type == 'pay' or tranc_type == 'dpay' %}
{% if tranc_type == 'dpay' %}
<tr>
	<th>垫付帐户</td>
	<td>{{ tranc.member.name }}</td>
</tr>
{% endif %}
<tr>
	<th>金额</th>
	<td>{{ tranc.amount }}元</td>
</tr>
<tr>
	<th>用途</th>
	<td>{{ tranc.usage }}</td>
</tr>
<tr>
	<th valign="top">备注</th>
	<td>{{ tranc.detail|default:"<i>无</i>" }}</td>
</tr>
<tr>
	<th>交易时间</th>
	<td>{{ tranc.time|local_time|date:"Y年n月d G点i分" }}</td>
</tr>
<tr>
	<th>创建者</th>
	<td>{{ tranc.creator.name }}</td>
</tr>
<tr>
	<th>创建时间</th>
	<td>{{ tranc.created|local_time|date:"Y年n月d G点i分" }}</td>
</tr>
<tr>
	<th valign="top">摊派方式</th>
	<td>
		<strong>{{ tranc.dist_mode|dist_mode_name }}</strong>
		<table class="dm">
		{% for item in tranc.get_dist_amounts %}
		<tr>
			<td>{{ item.0.name }}：</td>
			<td>{{ item.1 }}</td>
			<td>({{ item.2 }}%)</td>
		</tr>
		{% endfor %}
		</table>
	</td>
</tr>
{# === Transfer === #}
{% else %}{% if tranc_type == 'transfer' %}
<tr>
	<th>转出账户</th>
	<td>{{ tranc.member.name }}</td>
</tr>
<tr>
	<th>取入账户</th>
	<td>{{ tranc.to_member.name }}</td>
</tr>
<tr>
	<th>金额</th>
	<td>{{ tranc.amount }}元</td>
</tr>
<tr>
	<th>用途</th>
	<td>{{ tranc.usage }}</td>
</tr>
<tr>
	<th>备注</th>
	<td>{{ tranc.detail|default:"<i>无</i>" }}</td>
</tr>
<tr>
	<th>交易时间</th>
	<td>{{ tranc.time|local_time|date:"Y年n月d G点i分" }}</td>
</tr>
<tr>
	<th>创建者</th>
	<td>{{ tranc.creator.name }}</td>
</tr>
<tr>
	<th>创建时间</th>
	<td>{{ tranc.created|local_time|date:"Y年n月d G点i分" }}</td>
</tr>
{% endif %}{% endif %}{% endif %}{% endif %}
<tr class="buttons">
	<th></th>
	<td>
		<a class="button" href="delete/">删除</a>
		<a class="link" href="..">返回</a>
	</td>
</tr>
</table>

{% endwith %}{% endwith %}
{% endblock %}
